{extend name="../../admin/view/main"}

{block name="button"}

{/block}

{block name='content'}

<div class="layui-badge layui-bg-cyan text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
    预计返息统计：下月累计返息总额为 <b>{$total|default='0'}</b> 元 。
</div>

<div class="think-box-shadow margin-top-10 portal-block-container notselect">
    <div class="layui-tab-content">
        <fieldset>
            <div class="pull-right">
                {if auth('export')}
                <a class="layui-btn layui-btn-primary" data-form-export="{:url('index')}" type="button">
                    <i class="layui-icon layui-icon-export"></i> 导出当前
                </a>
                <a class="layui-btn layui-btn-primary" data-form-export="{:url('index')}?all=1" type="button">
                    <i class="layui-icon layui-icon-export"></i> 导出全部
                </a>
                {/if}
            </div>
        </fieldset>

        <table class="layui-table" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th>客户信息</th>
                <th>投资信息</th>
                <th>返息金额</th>
                <th>返息月份</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class="nowrap relative">
                    <div>
                        <div class="inline-block sub-strong-red">
                            <div>客户编号：<span class="color-red">{$vo.customer_no|default='--'}</span></div>
                            <div>客户名称：<span class="color-red">{$vo.name|default='--'}</span></div>
                            <div>身份证：<span class="color-text">{$vo.idcard|default='--'}</span></div>
                            <div>开户行：<span class="color-text">{$vo.account_bank|default='--'}</span></div>
                            <div>收款卡号：<span class="color-text">{$vo.bank_no|default='--'}</span></div>
                        </div>
                    </div>
                </td>
                <td class='nowrap'>
                    <div class="inline-block text-middle">
                        <div class="sub-strong-blue">投资产品：<b>{$vo.goods_name}</b></div>
                        <div class="sub-strong-blue">投资金额：<b>{$vo.money+0}</b> 元</div>
                        <div class="sub-strong-blue">
                            收款方式：
                            {eq name='vo.payment_method' value='0'} <b class="color-blue">划卡</b>{/eq}
                            {eq name='vo.payment_method' value='1'} <b class="color-blue">转账</b>{/eq}
                            {eq name='vo.payment_method' value='2'} <b class="color-blue">现金</b>{/eq}
                            {eq name='vo.payment_method' value='3'} <b class="color-blue">续投</b>{/eq}

                        </div>
                        <div class="sub-strong-blue">
                            年利率：<b>{$vo.goods_annual_rate}</b>%
                        </div>
                        <div>起息日期：<span class="color-text">{$vo.start_at}</span></div>
                        <div>到期日期：<span class="color-text">{$vo.end_at}</span></div>
                    </div>
                </td>
                <td class="nowrap">
                    <div class="inline-block text-middle">
                        <div class="sub-strong-green">
                            返息金额：<b>{$vo.month_money|default='--'}</b> 元
                        </div>
                    </div>
                </td>
                <td class="nowrap">
                    <div class="inline-block text-middle">
                        <div class="sub-strong-red">
                            返息月份：<b>{$vo.month}</b>
                        </div>
                    </div>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
<script>

    require(['excel'], function (excel) {
        excel.bind(function (data) {
            var items = [];
            items.push(['客户姓名','客户手机号','客户身份证号','开户行','收款卡号','客户编号','合同编号','投资金额(规模)',
                '收款方式', '产品名称', '起息日期', '到期日期', '返息月份','返息金额']);
            data.forEach(function (order) {
                switch(order.payment_method){
                    case 0:
                        order.payment_method = '转账'
                        break;
                    case 1:
                        order.payment_method = '划卡'
                        break;
                    case 2:
                        order.payment_method = '现金'
                        break;
                    case 3:
                        order.payment_method = '续投'
                        break;
                }
                items.push([
                    order.name,
                    order.phone,
                    order.idcard,
                    order.account_bank,
                    order.bank_no,
                    order.customer_no,
                    order.contract_no,
                    order.money,
                    order.payment_method,
                    order.goods_name,
                    order.start_at || '',
                    order.end_at,
                    order.month,
                    order.month_money,
                ]);
            });
            return items;
        }, '下月应返利息表');
    });

</script>

{/block}
